// import router from '@/credit/router'
// import { getData } from '@vimi/utils-api'
// import { dateFormat } from '@/common/utils/common'
// import { POSTLOAN_WARNING_DAY } from '@/credit/plugins/constant'
import { service } from '@vimi/utils-api'

const state = {
  taskCountBusSelfFast: {},
}

const getters = {
  taskCountBusSelfFast: state => state.taskCountBusSelfFast,
}

// this.$store.dispatch('...')
const actions = {
  async getTaskCountBusSelfFast({ commit, rootGetters }) {
    const res = await service.get(
      `/api/credit/task_list/statistics/?apiKey=todo-task-dir-quick&task_person=${rootGetters.userId}`
    )
    const data = res.data || {}
    commit('taskCountBusSelfFast', data)
    return data
  },
}

const mutations = {
  taskCountBusSelfFast: (state, payload) => (state.taskCountBusSelfFast = payload),
}

export default {
  state,
  getters,
  actions,
  mutations,
}
